//
//  SSBaseModel.m
//  starspaceVR
//
//  Created by 曹端芹 on 17/10/9.
//  Copyright © 2017年 starspace. All rights reserved.
//

#import "SSBaseModel.h"
#import "SSFileCacheManager.h"

@implementation SSBaseModel

MJCodingImplementation;

- (void)archive {
    [SSFileCacheManager saveObject:self byFileName:[self.class description]];
}

- (id)unarchiver {
    id obj = [SSFileCacheManager getObjectByFileName:[self.class description]];
    return obj;
}

- (void)remove {
    [SSFileCacheManager removeObjectByFileName:[self.class description]];
}
+ (id)modelWithDictionary:(NSDictionary *)dictionary {
    if ([dictionary isKindOfClass:[NSDictionary class]]) {
        return [self mj_objectWithKeyValues:dictionary];
    }
    return [[self alloc] init];
}

@end
